<?php
class getStates extends ActionHandler 
{
	function handleRequest($jsonData)
	{
		$timeStamp = time() + 8 * 3600;
		$data = $jsonData['params'];
		$ownerId = $data['ownerId'];
		$sql = "select state,sectionIndex,buildingId,leftTimes,deadline from ".$this->tables['state_profile']." where ownerId = ".$ownerId." and (leftTimes > 0 or deadline > ".$timeStamp.")";
		$result = $this->db->query($sql);
		$return = array();
		$count = 0;
		while($arr = $this->db->fetchArray($result))
		{
			$return['stateForBuild'][$count] = $arr;
			$count++;
		}
		$return['ownerId'] = $ownerId;
		return $return;
	}
}
?>
